﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default1.aspx.cs" Inherits="ERPWebDemos._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <link href="CSS/contextMenu.css" rel="stylesheet" type="text/css" />
    <link href="CSS/dhtmlwindow.css" rel="stylesheet" type="text/css" />
    
    <link href="CSS/rulcode.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
       .EnumClass
       {
           border:solid 1px Gray;
           background-color: #CEE2FF;
           position:absolute ;
           padding:0px 0px 0px 0px;  
       }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="GridView1" runat="server">
        </asp:GridView>
        <div class="TestDiv">
            afdsfasdkldfasjdlf<br />
            asdfadsfdasf
        </div>
        LookupForm:<input  type="text" EDTType="UserID" id="dddd" class="dddd" value=""/>  <input  type="text" id="Text1" class="dddd" value=""/>  <br />
        Enum:<input  type="text" EnumType="UserType" id="EnumText" class="EnumText" value=""/>  <br />
        <br />
        <input type="text" class="FieldText" BaseType="string" StrLength="10"/><br /><br />
        <input type="text" class="FieldText" BaseType="float"/>
        <br />                
        <asp:Button ID="Button1" runat="server" CssClass="SubmitButton" Text="Button" 
            onclick="Button1_Click" />                                  
        <a  href="Tools/EDTLookUpForm.aspx?id=dddd&edttype=UserID">关闭</a>
        <div id="UserMenu" style="position: absolute; display: none; top: 0px; left: 0px; width: 130px;
        margin: 0px;  border: 1px solid #cccccc; background-color: #CEE2FF;">
        <ul  class="MenuUl">   
            <li  class="MenuItem" id="adduser" >增加好友</li>
            <li class="MenuItem" id="edituser">编辑好友</li>
            <li class="MenuItem" id="deluser">删除好友</li>                           
        </ul>
    </div>  
    </div>
    <script src="JS/jquery-1.3.2.min.js" type="text/javascript"></script> 
    <script src="JS/jquery.contextmenu.js" type="text/javascript"></script>
    <script type="text/javascript" src="JS/dhtmlwindow.js"></script>

    <script src="JS/jquery.rulecode.js" type="text/javascript"></script>
    <script type="text/javascript">
        function ContextMenu(property) {
            this.property = property;                    
            ContextMenu.prototype=  {
                alert:function (){alert(this.property);}
            }
        }
        var con = new ContextMenu("asdfasdf");
        
        $.ContextMenuManager.CreateContextMenu({
        menuID: "UserMenu",
        targetClass: "TestDiv" //
        },
                        {
                            bindings: {
                            'adduser': function(o) {
                                    alert(1);
                                },
                                'edituser': function(o) {
                                alert(1);
                            },
                            'deluser': function(o) {

                                alert(1);
                                } 
                            }
                        }
                    );
                    
                    
                    
                        var addFrame = null;
                        $(".dddd").focus(function() {
                            addFrame = dhtmlwindow.open('iframebox_add', 'iframe', 'Tools/EDTLookUpForm.aspx?id='+$(this).attr("id")+'&edttype='+$(this).attr("EDTType"), '增加记录', 'width=480px,height=300px,center=1,top=100px,resize=1,scrolling=1');
                            
                        }).keydown(function() { return false; });

                        function closeFrame() {
                            if(addFrame !=null )
                                dhtmlwindow.close(addFrame);
                        }

                        $("#EnumText").focus(function() {
                            var newDiv;
                            if ($(".EnumSelectDiv").length == 0) {
                                newDiv = document.createElement("div"); document.body.appendChild(newDiv);
                            }
                            else
                            { newDiv = $(".EnumSelectDiv")[0] }
                            if (!$(newDiv).hasClass("EnumSelectDiv"))
                                $(newDiv).addClass("EnumSelectDiv"); 
                            var position = $(this).position();
                            $(newDiv).css("left", position.left + "px").css("top", position.top + $(this).outerHeight() + "px").width($(this).outerWidth() + "px").html("").show();
                            $(newDiv).append("<ul><li>1</li><li>2</li></ul>");
                            var dd = $(this);
                            $(newDiv).find("li").click(function() {
                                dd.attr("value", $(this).html());
                            });
                        }).keydown(function() { return false; });
                        
                        $(document).bind("click", function(evt) {
                            if (!$(evt.target).hasClass("EnumText"))
                                $(".EnumSelectDiv").hide();
                            if (!$(evt.target).hasClass("dddd"))
                                closeFrame();
                        });


                        $(document).ready(function() {
                            $.TableFieldValidate.Vaidate("FieldText", "SubmitButton");
                        });
                         
                        
    </script>
    </form>
</body>
</html>
